<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>订购表</title>

    <!-- 使用 Thymeleaf 引入 head.jsp -->
    <th:block th:insert="~{/head :: head}"></th:block>

    <script type="text/javascript">
        function checkAll(obj){
            // 获取复选框对象
            var boxs = document.getElementsByName("ids");
            for(var i = 0; i < boxs.length; i++){
                // 循环设置第 i 个复选框被选中
                boxs[i].checked = obj.checked;
            }
        }
    </script>
</head>
<body>
<div th:insert="~{header::header}"></div>
<div id="main">
    <!-- Start: Sidebar -->
    <div th:insert="~{purchase/left::aside}"></div>

    <!-- Start: Content -->
    <section id="content">
        <div id="topbar" class="affix">
            <ol class="breadcrumb">
                <li><a th:href="@{/purchase/toPurchase}"><span class="glyphicon glyphicon-home"></span></a></li>
                <li class="active">订购表管理</li>
            </ol>
        </div>
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel">
                        <div class="panel-heading">
                            <div class="panel-title">订购表</div>
                        </div>
                        <form th:action="@{/purchase/totalOrders_Add}" method="post">
                            <div class="panel-body">
                                <table class="table table-striped table-bordered table-hover dataTable">
                                    <tr class="active">

                                        <th>教材ID</th>
                                        <th>教材名</th>
                                        <th>作者</th>
                                        <th>ISBN</th>
                                        <th>价格</th>
                                        <th>出版日期</th>
                                        <th>版本</th>
                                        <th>采购数量</th>
                                        <th>总价格</th>
                                    </tr>

                                    <!-- Thymeleaf 循环替代 c:forEach -->
                                    <tr th:each="m,s: ${totalOrders}">
                                        <td th:text="${m.textbookId}"></td>
                                        <td th:text="${m.textbookName}"></td>
                                        <td th:text="${m.author}"></td>
                                        <td th:text="${m.isbn}"></td>
                                        <td th:text="${m.price}"></td>
                                        <td th:text="${m.publishDate}"></td>
                                        <td th:text="${m.version}"></td>
                                        <td th:text="${m.purchaseQuantity}"></td>
                                        <td th:text="${m.TotalPrice}"></td>


                                    </tr>
                                </table>
                                <button type="submit" >保存定购单</button>
                                <br>
                                <a th:href="@{/purchase/setOrderStatus}">设置为已定购</a>


                                <div style="font-size:18px;color: #fe561f">[[*{msg}]]</div>
                            </div>

                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- End: Content -->
</div>
</body>
</html>